package com.prs.crm.dao.approval.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.approval.ChaiLvDao;
import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.domain.approval.ChaiLv;

public class ChaolvDaoImpl extends BaseDaoImpl<ChaiLv> implements ChaiLvDao{

	@Override
	public List<ChaiLv> getAllChailv() {
		Criteria cri = this.getSession().createCriteria(ChaiLv.class);
		return cri.list();
	}

	@Override
	public ChaiLv getchailvByid(Integer id) {
		Criteria cri = this.getSession().createCriteria(ChaiLv.class) 
		 .add(Restrictions.eq("id", id));
		return (ChaiLv) cri.list().get(0);
	}

	@Override
	public void saveChailv(ChaiLv cl) {
		this.getHibernateTemplate().saveOrUpdate(cl);
		
	}
	
}
